//删除站点和更新路线
        void button2_Click(object sender, EventArgs e)
        {
            /// <summary>
            /// 删除线路中的站点
            /// 说明:根据站点的名称,找到合适的线路(同上)
            /// 根据线路LineStation中Direction=0 和 Direction=1的两种情况分别按num进行排序
            /// 将线路中LINESTATION中 的所有站点数据 按下面的规则进行调整
            /// 如果首站点的 第一条数据的AStation=StationName,则删除该数据,并重新调整编号num
            /// 如果是最后一站,则判断BStation ,如果相等,则直接删除
            /// 如果中间站点 AStation 不等于 StationName,则只比较BStation中的数据是否和StationName相等
            /// 如果相同,则删除该数据,并将下一个数据的AStation改成该条数据的AStation
            /// 对站点处理完成后,要及时退出循环,避免做无用的循环数据
            /// 要分别对Direction=0 和 Direction=1的处理。
            /// NEWTRAIN中的数据调整比较简单,只要把Line中的 武汉- 和 -武汉 替换成空字符串就可以了。
            /// 此操作比较重要,要使用事务处理。
            /// </summary>

            if (int.Parse(this.scount.Value) > 0)
            {
                NewTrainBU bu   = new NewTrainBU();
                bool       flag = bu.DeleteTrainStation(this.txt1.Text.Trim());
                if (flag)
                {
                    JAjax.Alert("删除成功");
                }
                else
                {
                    JAjax.Alert("删除失败");
                }
            }
            else
            {
                JAjax.Alert("删除的站点不存在!");
            }
        }
Esempio n. 2
0
        protected void but1_Click(object sender, EventArgs e)
        {
            //处理系统的升级
            DBUpgrade.GoUpdate();

            //Response.Redirect("MainFrame.aspx", true);
            JAjax.Alert("升级已完成!");
        }
 void but_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(Request.QueryString["doc"]) == false)
     {
         String docFile = Server.MapPath(Request.QueryString["doc"]);
         PubFun.SaveTxtFileInfo(docFile, this.txt1.Text, Encoding.UTF8);
         JAjax.Alert("提示:保存操作成功!");
     }
 }
Esempio n. 4
0
        //增加新的上传文件
        void but1_Click(object sender, EventArgs e)
        {
            if (file.HasFile)
            {
                if (file.CheckData())
                {
                    String dir1 = HttpContext.Current.Server.MapPath(this.AttachmentPath);
                    //如果路径不存在,则创建
                    if (System.IO.Directory.Exists(dir1) == false)
                    {
                        System.IO.Directory.CreateDirectory(dir1);
                    }
                    String   trueName    = Path.GetFileName(file.FileName);
                    DateTime dt          = DateTime.Now;
                    string   picfileName = "$$" + dt.Year + "" + dt.Month + "" + dt.Day + "" + dt.Hour + "" + dt.Minute + "" + dt.Second + "" + dt.Millisecond + Path.GetExtension(trueName);
                    //组合路径,file.GetName()取得文件名
                    dir1 = dir1 + "/" + picfileName;
                    file.SaveAs(dir1);

                    //将数据保存到视图状态
                    DataTable dt1 = this.AttachmentList;
                    DataRow   dr1 = dt1.NewRow();

                    dr1["GUIDID"]          = Guid.NewGuid().ToString();
                    dr1["PARENTGUID"]      = this.ParentID;
                    dr1["FILENAME"]        = trueName;
                    dr1["ENCRYPTFILENAME"] = picfileName;
                    dr1["UPLOADTIME"]      = DateTime.Now;
                    dr1["UPLOADPERSON"]    = FrameLib.UserID;
                    dr1["FILEDIR"]         = this.AttachmentPath;
                    dr1["Describle"]       = txtFileDesc.Text; //附件描述
                    String ext1 = Path.GetExtension(trueName).ToLower();
                    if (ext1 == ".bmp" || ext1 == ".gif" || ext1 == ".png" || ext1 == ".jpg" || ext1 == ".jpeg")
                    {
                        dr1["Kind"] = "0";
                    }
                    dr1["DataStatus"] = "newdata";  //表示是新数据(提交时需要进一步处理)
                    dr1["DEL"]        = "0";
                    dt1.Rows.Add(dr1);
                    this.AttachmentList = dt1;      //重新保存到视图状态

                    //绑定List显示的数据
                    this.BindList();
                }
                else
                {
                    JAjax.Alert(this.file.ErrorInfo);
                }
            }
            else
            {
                JAjax.Alert("提示:请选择一个要上传的文件!");
            }
        }
Esempio n. 5
0
 //提交密码修改
 protected void but1_Click(object sender, EventArgs e)
 {
     if (FrameLib.CheckData(this.but1))
     {
         MyUserName bu1  = new MyUserName();
         bool       succ = bu1.UpdatePassWord(Page.User.Identity.Name, this.oldPass.Text, this.password1.Text);
         if (succ == false)
         {
             JAjax.Alert("错误:老密码输入不正确,请检查后重新输入!");
         }
         else
         {
             JAjax.AlertAndGoUrl("提示:密码已成功修改,你需要重新登录!", "/SignOut.aspx");
         }
     }
 }
Esempio n. 6
0
 protected void but1_Click(object sender, EventArgs e)
 {
     //处理系统的升级
     if (this.Password.Text == "kin90rient")
     {
         bool succ = KIPBU.SetIPs(this.KIPs.Text.ToString().Trim());
         if (succ)
         {
             JAjax.Alert("设置完成!");
         }
         else
         {
             JAjax.Alert("设置失败!");
         }
     }
 }
        //确定返回
        void buttonSearch_Click(object sender, EventArgs e)
        {
            String selLine = String.Empty;

            foreach (RepeaterItem item in this.repeater1.Items)
            {
                String t1 = String.Empty;
                String a1 = (item.FindControl("astation") as TextBox).Text.Trim();
                String b1 = (item.FindControl("bstation") as TextBox).Text.Trim();
                String c1 = (item.FindControl("sd") as DropDownList).SelectedValue.Trim();

                if (a1 != String.Empty && b1 != String.Empty)
                {
                    String id1 = (item.FindControl("lineid") as TextBox).Text.Trim();
                    if (id1 != String.Empty)
                    {
                        t1 = a1 + "-" + b1 + "(" + id1 + "#" + c1 + ")";
                    }
                    else
                    {
                        t1 = a1 + "-" + b1 + "(" + "0" + "#" + c1 + ")";
                    }
                    if (selLine == String.Empty)
                    {
                        selLine = t1;
                    }
                    else
                    {
                        selLine = selLine + "," + t1;
                    }
                }
            }

            if (selLine != String.Empty)
            {
                String js = "";
                js = js + "var parentid = '" + Request.QueryString["parent"] + "';";
                js = js + " if (parentid != '' && window.opener != null) { ";
                js = js + " window.opener.document.getElementById(parentid).value = '" + selLine + "'; ";
                js = js + " window.close(); }";
                JAjax.ExecuteJS(js);
            }
            else
            {
                JAjax.Alert("错误:没有选择合适的分段!");
            }
        }
Esempio n. 8
0
        protected void txtbegin_TextChanged(object sender, EventArgs e)
        {
            int temp = 0;

            this.lblbegin.Text  = this.txt1.Text;
            this.lblmid.Text    = this.newstation.Text;
            this.lblmiddle.Text = this.newstation.Text;
            this.ldllast.Text   = this.txt2.Text;

            if (this.txtbegin.Text.Trim() == "")
            {
                JAjax.Alert(string.Format("{0} 至{1}的距离不能为空!", this.lblbegin.Text, this.lblmid.Text));
                return;
            }

            if (int.TryParse(this.txtbegin.Text.Trim(), out temp) == false)
            {
                JAjax.Alert(string.Format("{0} 至{1}的距离必须是整数!", this.lblbegin.Text, this.lblmid.Text));
                return;
            }

            NewTrainBU bu = new NewTrainBU();
            DataRow    dr = bu.GetDataRowFromLineStation(this.txt1.Text.Trim(), this.txt2.Text.Trim(), "0");//在LineStation表中得到Astation ,bstation的值等于选中路线值的lineid,注意方向Directory=0的情况

            if (dr == null)
            {
                JAjax.Alert(string.Format("不存在{0} 至{1}的直通线路,中间已存在其它站点!", this.txt1.Text.Trim(), this.txt2.Text.Trim()));
                return;
            }

            if (Convert.ToInt32(this.txtbegin.Text.ToString().Trim()) > Convert.ToInt32(dr["Miles"]))
            {
                JAjax.Alert(string.Format("{0} 至{1}的距离已大于{2}到{3}的距离!", this.lblbegin.Text, this.lblmid.Text, this.lblbegin.Text, this.ldllast.Text));
                return;
            }

            if (dr != null)
            {
                txtlast.Text = (Convert.ToInt32(dr["Miles"]) - Convert.ToInt32(txtbegin.Text.ToString())).ToString();
            }
        }
Esempio n. 9
0
 //成批更新站点的名称
 void button1_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(txt1.Text.Trim()) == false &&
         String.IsNullOrEmpty(txt2.Text.Trim()) == false)
     {
         NewTrainBU bu   = new NewTrainBU();
         bool       flag = bu.ChangeTrainStationName(this.txt1.Text.Trim(), this.txt2.Text.Trim());
         if (flag)
         {
             JAjax.Alert("更改成功!");
         }
         else
         {
             JAjax.Alert("更改失败,请重试!");
         }
     }
     else
     {
         JAjax.Alert("错误:请输入站点的名称!");
     }
 }
Esempio n. 10
0
        void butSubmit_Click(object sender, EventArgs e)
        {
            int    chooseNum = 0;
            string num       = "";
            bool   first     = true;

            foreach (RepeaterItem item in Repeater1.Items)
            {
                CheckBox cbox = item.FindControl("SelCost") as CheckBox;
                if (cbox != null && cbox.Checked)
                {
                    TextBox box         = item.FindControl("TextBox1") as TextBox;
                    Label   lbllinename = item.FindControl("lblname") as Label;

                    if (first)
                    {
                        if (box != null)
                        {
                            num   = box.Text.Trim();
                            first = false;
                        }
                    }
                    else
                    {
                        num = num + "&&" + box.Text.Trim();
                    }

                    chooseNum++;
                }
            }
            if (chooseNum == 0)
            {
                JAjax.Alert("请勾选可变成本!");
            }
            else
            {
                this.selectDetialId.Value = num;
                this.winClose.Value       = "1";
            }
        }
        void yw_TextChanged(object sender, EventArgs e)
        {
            try
            {
                int cat = int.Parse(this.ca.Text);
                if (cat > 1)
                {
                    JAjax.Alert("错误:餐车的数值只能为0或1");
                }
                else
                {
                    int syc = int.Parse(this.sy.Text);
                    if (syc > 1)
                    {
                        JAjax.Alert("错误:宿营车的数值只能为0或1");
                    }
                    else
                    {
                        int t1 = int.Parse(this.yz.Text) + int.Parse(this.yw.Text) + int.Parse(this.rw.Text)
                                 + int.Parse(this.ca.Text) + int.Parse(this.sy.Text);

                        if (t1 >= 10 && t1 <= 21)
                        {
                            if (ViewState["Line1"] != null)
                            {
                                this.SearchLine();
                            }
                        }
                        else
                        {
                            JAjax.Alert("错误:列车编组数值的和必须在【10-21】之间!");
                        }
                    }
                }
            }
            catch (Exception err)
            {
                JAjax.Alert("错误:请输入数值,0不能用空代替!");
            }
        }
Esempio n. 12
0
        void button1_Click(object sender, ImageClickEventArgs e)
        {
            //System.Web.Security.FormsAuthentication.RedirectFromLoginPage(this.UserID.Text, false);

            String ip1 = KIPBU.GetIPs();

            if (String.IsNullOrEmpty(ip1) == false)
            {
                String[]      ips   = ip1.Split(',');
                List <String> list1 = new List <string>();
                foreach (String m in ips)
                {
                    if (list1.Contains(m) == false)
                    {
                        list1.Add(m);
                    }
                }

                String soureceIP = Request.UserHostAddress;
                if (list1.Contains(soureceIP))
                {
                    if (String.IsNullOrEmpty(this.UserID.Text) == false &&
                        String.IsNullOrEmpty(this.PassWord.Text) == false)
                    {
                        MyUserName user1 = new MyUserName();
                        bool       succ  = user1.Login(this.UserID.Text, this.PassWord.Text);
                        if (succ)
                        {
                            FrameLib.UserID   = this.UserID.Text;
                            FrameLib.DepartID = "DepartID";



                            //基础数据初始化
                            //基础数据发生变化时,重写这些数据;

                            ChexianBianZhuData.Init();
                            LiChengProfile.Init();
                            LiChengJianRate.Init();
                            JiaKuaiProfile.Init();
                            LineProfile.Init();
                            // QianYinFeeProfile.Init();
                            CheXianProfile.Init();
                            HighTrainProfile.Init();
                            TrainLineKindProfile.Init();
                            TrainProfile.Init();
                            PersonGZProfile.Init();
                            RiChangFeeProfile.Init();
                            A2A3FeeProfile.Init();

                            //调整夏冬切换的线路
                            TrainLine.ExchangeSpringAndWinter();

                            //处理系统的升级
                            AppCode.Upgrade.Go();

                            Response.Redirect("TrainWeb/MainFrame.aspx", true);
                        }
                        else
                        {
                            JAjax.Alert("错误:用户名或密码不正确!");
                        }
                    }
                }
                else
                {
                    Response.Redirect("/GenericErrorPage.htm", true);
                }
            }
            else
            {
                Response.Redirect("/GenericErrorPage.htm", true);
            }
        }
Esempio n. 13
0
        //更新数据
        public bool UpdateData(Dictionary <String, object> data1)
        {
            bool result = false;
            List <SearchField> condition = new List <SearchField>();
            JTable             tab1      = new JTable();
            JTable             tab2      = new JTable();
            JTable             tab3      = new JTable("LineStation");

            try
            {
                tab1.MyConnect.BeginTrans();

                //更新CHANGJIAOQYFEE表中信息
                tab1.TableName = "CHANGJIAOQYFEE";
                String lineid = String.Empty;
                if (data1["lineid"] == null ||
                    data1["lineid"].ToString() == String.Empty ||
                    data1["lineid"].ToString() == "-1")
                {
                    data1.Remove("lineid");
                    tab1.InsertData(data1);

                    tab2.TableName = "CHANGJIAOQYFEE";
                    condition.Clear();
                    condition.Add(new SearchField("linename", data1["linename"].ToString().Trim()));
                    tab2.OrderBy = "lineid desc";
                    DataRow dr1 = tab2.GetFirstDataRow(condition, "lineid");
                    if (dr1 != null)
                    {
                        lineid = dr1["lineid"].ToString().Trim();
                    }
                    tab2.Close();
                }
                else
                {
                    lineid = data1["lineid"].ToString();
                    condition.Clear();
                    condition.Add(new SearchField("lineid", data1["lineid"].ToString().Trim(), SearchFieldType.NumericType));
                    tab1.EditData(data1, condition);
                }


                //更新LineStation中的相关数据
                if (String.IsNullOrEmpty(lineid) == false)
                {
                    //线路
                    String        error     = String.Empty;
                    String        lineName  = data1["linename"].ToString();
                    List <String> arrlineID = CheckLine(lineName, out error);
                    int           fee1      = int.Parse(data1["fee1"].ToString());
                    int           fee2      = int.Parse(data1["fee2"].ToString());
                    int           fee3      = 0;

                    if (String.IsNullOrEmpty(error))
                    {
                        Dictionary <String, object> data2 = new Dictionary <string, object>();
                        data2["checkflag"] = "1";
                        JTable tab4 = new JTable("CHANGJIAOQYFEE");
                        condition.Clear();
                        condition.Add(new SearchField("lineid", lineid, SearchFieldType.NumericType));
                        tab4.EditData(data2, condition);
                        tab4.Close();

                        //线路站点
                        String   jiaolu    = data1["jiaolu"].ToString();
                        String[] arrJiaolu = jiaolu.Replace("~", "-").Replace("~", "-").Replace("-", "-").Split('-');
                        for (int i = 0; i < arrJiaolu.Length - 1; i++)
                        {
                            //调整字符中的分隔符。
                            String[] a0 = arrJiaolu[i].Trim().Replace("、", ";").Replace(",", ";").Replace(",", ";").Replace(".", ";")
                                          .Replace("(", ";").Replace(")", "").Replace("(", ";").Replace(")", "").Split(';');
                            String[] a1 = arrJiaolu[i + 1].Trim().Replace("、", ";").Replace(",", ";").Replace(",", ";").Replace(".", ";")
                                          .Replace("(", ";").Replace(")", "").Replace("(", ";").Replace(")", "").Split(';');

                            for (int j = 0; j < a0.Length; j++)
                            {
                                a0[j] = a0[j].Trim();
                                if (j > 0)
                                {
                                    if (a0[j] == "东" || a0[j] == "南" || a0[j] == "西" || a0[j] == "北")
                                    {
                                        a0[j] = a0[j - 1] + a0[j];
                                    }
                                }
                            }

                            for (int j = 0; j < a1.Length; j++)
                            {
                                a1[j] = a1[j].Trim();
                                if (j > 0)
                                {
                                    if (a1[j] == "东" || a1[j] == "南" || a1[j] == "西" || a1[j] == "北")
                                    {
                                        a1[j] = a1[j - 1] + a1[j];
                                    }
                                }
                            }

                            //提交数据更新
                            foreach (String Astation in a0)
                            {
                                foreach (String Bstation in a1)
                                {
                                    UpdateLineStation(tab3, arrlineID, Astation, Bstation, fee1, fee2, fee3);
                                }
                            }
                        }
                    }
                    else
                    {
                        JAjax.Alert(error);
                    }
                }

                //提交事务处理
                tab1.MyConnect.CommitTrans();
                result = true;
            }
            catch (Exception err)
            {
                tab1.MyConnect.RollBackTrans();
                ;
            }

            tab1.Close();
            tab2.Close();
            tab3.Close();
            return(result);
        }
Esempio n. 14
0
        //提交数据,插入站点
        void btnSubmit_Click(object sender, EventArgs e)
        {
            //初始化
            this.lblbegin.Text  = this.txt1.Text;
            this.lblmid.Text    = this.newstation.Text;
            this.lblmiddle.Text = this.newstation.Text;
            this.ldllast.Text   = this.txt2.Text;

            int temp = 0;

            if (this.lblbegin.Text.ToString().Trim() == this.lblmid.Text.ToString().Trim())
            {
                JAjax.Alert(string.Format("新站点{0} 与起始站点{1}同名!", this.lblbegin.Text, this.lblmid.Text));
                return;
            }
            if (this.lblmiddle.Text.ToString().Trim() == this.ldllast.Text.ToString().Trim())
            {
                JAjax.Alert(string.Format("新站点{0} 与到达站点{1}同名!", this.lblmiddle.Text, this.ldllast.Text));
                return;
            }
            if (int.TryParse(this.txtbegin.Text.Trim(), out temp) == false)
            {
                JAjax.Alert(string.Format("{0} 至{1}的距离必须是整数!", this.lblbegin.Text, this.lblmid.Text));
                return;
            }
            else if (int.TryParse(this.txtlast.Text.Trim(), out temp) == false)
            {
                JAjax.Alert(string.Format("{0} 至{1}的距离必须是整数!", this.lblmiddle.Text, this.ldllast.Text));
                return;
            }
            else
            {
                NewTrainBU bu = new NewTrainBU();
                DataRow    dr = bu.GetDataRowFromLineStation(this.txt1.Text.Trim(), this.txt2.Text.Trim(), "0");//在LineStation表中得到Astation ,bstation的值等于选中路线值的lineid,注意方向Directory=0的情况
                if (dr == null)
                {
                    JAjax.Alert("该站点路线不存在!");
                    return;
                }
                if (Convert.ToInt32(this.txtbegin.Text) + Convert.ToInt32(txtlast.Text) != Convert.ToInt32(dr["Miles"]))
                {
                    JAjax.Alert(string.Format("{0} 至{1}的距离与{2}至{3}的距离之和与{4}到{5}的距离不相等!", this.lblbegin.Text, this.lblmid.Text, this.lblmiddle.Text, this.ldllast.Text, this.lblbegin.Text, this.ldllast.Text));
                    return;
                }
                else
                {
                    JConnect conn = JConnect.GetConnect();
                    conn.BeginTrans();
                    try
                    {
                        if (dr != null)
                        {
                            InsertLineStation(dr, "0");//direction=0的插入操作
                        }
                        DataRow dr1 = bu.GetDataRowFromLineStation(this.txt2.Text.Trim(), this.txt1.Text.Trim(), "1");
                        if (dr1 != null)
                        {
                            InsertLineStation(dr1, "1");//direction=1的插入操作
                        }
                        conn.CommitTrans();
                        JAjax.Alert("提交成功!");
                    }
                    catch (Exception ex)
                    {
                        conn.RollBackTrans();
                        JAjax.Alert("提交失败!");
                    }
                }
            }
        }