Пример #1
0
        public static string Add_Fwx_other(DataSet DS_Fwx_other_temp, string yydh)
        {
            string s = common_file.common_app.get_failure;

            if (DS_Fwx_other_temp != null && DS_Fwx_other_temp.Tables[0].Rows.Count > 0)
            {
                Model.Fwx_other M_Fwx_other = new Model.Fwx_other();
                BLL.Fwx_other   B_Fwx_other = new BLL.Fwx_other();
                string          strlsbh_ds  = ""; //记录总的lsbh以“,”号隔开
                foreach (DataRow dr in DS_Fwx_other_temp.Tables[0].Rows)
                {
                    string strLsbh = dr["lsbh"].ToString();

                    M_Fwx_other.yydh = dr["yydh"].ToString();
                    M_Fwx_other.qymc = dr["qymc"].ToString();
                    M_Fwx_other.lsbh = dr["lsbh"].ToString();
                    M_Fwx_other.fjrb = dr["fjrb"].ToString();
                    M_Fwx_other.fjbh = dr["fjbh"].ToString();
                    M_Fwx_other.ddsj = Convert.ToDateTime(dr["ddsj"].ToString());
                    M_Fwx_other.lksj = Convert.ToDateTime(dr["lksj"].ToString());
                    M_Fwx_other.bz   = dr["bz"].ToString();
                    M_Fwx_other.zyzt = dr["zyzt"].ToString();
                    M_Fwx_other.czsj = Convert.ToDateTime(dr["czsj"].ToString());
                    M_Fwx_other.cznr = dr["cznr"].ToString();
                    M_Fwx_other.czy  = dr["czy"].ToString();
                    M_Fwx_other.shsc = true;

                    //如果有相同lsbh就修改,,然后添加。
                    DataSet ds = B_Fwx_other.GetList("lsbh='" + strLsbh + "'");

                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {
                        int fid = Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString());
                        M_Fwx_other.id = fid;
                        if (B_Fwx_other.Update(M_Fwx_other))
                        {
                            s = common_file.common_app.get_suc;
                        }
                    }
                    else
                    {
                        if (B_Fwx_other.Add(M_Fwx_other) > 0)
                        {
                            s = common_file.common_app.get_suc;
                        }
                    }
                    strlsbh_ds += "'" + strLsbh + "'" + ",";  //累加lsbh以“,”号相隔
                }
                s = common_file.common_app.get_suc;
                //相反不相等的话就删除,防止本地删除中央服务器还没有删除lsbh not in
                if (strlsbh_ds.Length != 0)
                {
                    strlsbh_ds = strlsbh_ds.Remove(strlsbh_ds.Length - 1, 1);
                    string strsql = "delete from Fwx_other where lsbh not in(" + strlsbh_ds + ") and yydh='" + yydh + "'";
                    DbHelperSQL.ExecuteSql(strsql);
                    s = common_file.common_app.get_suc;
                }
            }
            return(s);
        }
Пример #2
0
        // id,yydh,qymc,lsbh,fjrb,fjbh,ddsj,lksj,bz,zyzt,czsj,cznr,czy,is_top,is_select,shsc
        public string Fwx_other_UploadDS(DataSet DS_Fwxother)  //άÐÞ·¿ÉÏ´«
        {
            DbHelperSQLP Helpsql = new DbHelperSQLP();
            string       s       = common_file.common_app.get_failure;

            BLL.Fwx_other   B_Fwx_other = new BLL.Fwx_other();
            Model.Fwx_other M_Fwx_other = new Model.Fwx_other();
            if (DS_Fwxother != null && DS_Fwxother.Tables[0].Rows.Count > 0)
            {
                string dsqymc = DS_Fwxother.Tables[0].Rows[0]["yydh"].ToString();
                DbHelperSQL.ExecuteSql("delete from Fwx_other where yydh='" + dsqymc + "'");
                foreach (DataRow dr in DS_Fwxother.Tables[0].Rows)
                {
                    SqlParameter[] parameters =
                    {
                        new SqlParameter("@yydh",      SqlDbType.VarChar,   50),
                        new SqlParameter("@qymc",      SqlDbType.VarChar,   50),
                        new SqlParameter("@lsbh",      SqlDbType.VarChar,   50),
                        new SqlParameter("@fjrb",      SqlDbType.VarChar,   50),
                        new SqlParameter("@fjbh",      SqlDbType.VarChar,   50),
                        new SqlParameter("@ddsj",      SqlDbType.DateTime),
                        new SqlParameter("@lksj",      SqlDbType.DateTime),
                        new SqlParameter("@bz",        SqlDbType.VarChar,   50),
                        new SqlParameter("@zyzt",      SqlDbType.VarChar,   50),
                        new SqlParameter("@czsj",      SqlDbType.DateTime),
                        new SqlParameter("@cznr",      SqlDbType.VarChar,   50),
                        new SqlParameter("@czy",       SqlDbType.VarChar,   50),
                        new SqlParameter("@is_top",    SqlDbType.Bit,        1),
                        new SqlParameter("@is_select", SqlDbType.Bit,        1),
                        new SqlParameter("@shsc",      SqlDbType.Bit, 1)
                    };
                    parameters[0].Value  = dr[1];
                    parameters[1].Value  = dr[2];
                    parameters[2].Value  = dr[3];
                    parameters[3].Value  = dr[4];
                    parameters[4].Value  = dr[5];
                    parameters[5].Value  = Convert.ToDateTime(dr[6]);
                    parameters[6].Value  = Convert.ToDateTime(dr[7]);
                    parameters[7].Value  = dr[8];
                    parameters[8].Value  = dr[9];
                    parameters[9].Value  = Convert.ToDateTime(dr[10]);
                    parameters[10].Value = dr[11];
                    parameters[11].Value = dr[12];
                    parameters[12].Value = Convert.ToBoolean(dr[13]);
                    parameters[13].Value = Convert.ToBoolean(dr[14]);
                    parameters[14].Value = true;
                    Helpsql.RunProcedure("Fwx_other_ADD", parameters);
                    s = common_file.common_app.get_suc;
                }
            }
            return(s);
        }
Пример #3
0
        public Fwx_other_add_edit(Fwx_other_browse Fwx_other_browse_temp, string id)
        {
            InitializeComponent();
            Fwx_other_id = id;
            if (id != "")
            {
                M_Fwx_other = B_Fwx_other.GetModel(int.Parse(id));

                tB_fjrb.Text       = M_Fwx_other.fjrb;
                tB_fjbh.Text       = M_Fwx_other.fjbh;
                dT_ddsj_date.Value = M_Fwx_other.ddsj;
                dT_ddsj_time.Value = M_Fwx_other.ddsj;
                dT_lksj_date.Value = M_Fwx_other.lksj;
                dT_lksj_time.Value = M_Fwx_other.lksj;
                zyzt       = M_Fwx_other.zyzt;
                tB_bz.Text = M_Fwx_other.bz;
            }
            Fwx_other_browse_temp_app = Fwx_other_browse_temp;
        }